@tool
class_name BaseContextBehavior
extends Resource

#region 属性
@export var behavior_type:GameEnum.ContextBehaviorType
@export var enable:bool:
	set = setter_enable
@export var sensitive:float = 1
@export var is_debug:bool = false
var behaviors_owner:Node
var agent:SteeringBehaviorAgent
var inited:bool = false
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
#endregion
#region 公共方法
func init():
	if inited:
		return
func setter_enable(value):
	enable = value
func calc_steering(behaviors_owner:Node,agent:SteeringBehaviorAgent,delta:float):
	self.behaviors_owner = behaviors_owner
	self.agent = agent
	init()
#endregion
#region 私有方法
#endregion
#region 生命周期函数
func _init() -> void:
	if Engine.is_editor_hint():
		resource_local_to_scene = true
func draw() -> void:
	GameSteeringBehaviorDebug.draw_line(agent.position,agent.get_pos() + Vector2(cos(agent.global_rotation),sin(agent.global_rotation)) * agent.body_radius * 2 - agent.get_pos(),Color.CORNFLOWER_BLUE,2)
#endregion
